<?php
/**
 *	smarty function:is_required
 *
 *	nameで与えられたものが必須かどうかのチェック
 *
 *	sample:
 *	<code>
 *	{is_required name='admin_index'}
 *	</code>
 *
 *	@param	string	Ethna_ActionName
 *	@return	bool	
 */
function smarty_function_is_required($params, &$smarty)
{
	extract($params); // ex: get $name = 'namae';

	$name = isset($name) ? $name : false ;
	
    $c =& Ethna_Controller::getInstance();
    $action_form =& $c->getActionForm();
    if ($name === null) {
        return false ;
    } else {
		$def = $action_form->getDef($name);
		$ret = isset($def['required']) ? $def['required'] : false;
        return $ret;
    }
}
?>